02/05/2022

Session SE18

Some R online resources

Where to get R packages

This Demo

Beginning with RStudio and git

Some demo requirements

Please execute the code before continue the presentation

# Install some standard spatial packages from CRAN
if (!require("sf", quietly = TRUE))
  install.packages("sf")
if (!require("terra", quietly = TRUE))
  install.packages("terra")
if (!require("knitr", quietly = TRUE))
  install.packages("knitr")
if (!require("glue", quietly = TRUE))
  install.packages("glue")
if (!require("remotes", quietly = TRUE))
  install.packages("remotes")

# package from Bioconductor
if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install()
BiocManager::install("EBImage")
## Warning: package(s) not installed when version(s) same as current; use `force = TRUE` to
##   re-install: 'EBImage'

ReLTER installation

# Install the dev version of ReLTER for use new function
if (!require("ReLTER", quietly = TRUE))
  remotes::install_github("ropensci/ReLTER", force = TRUE)

## ReLTER is specially drafted for the LTER community.
## 
## To contribute to the improvement of this package, join the group of
##     developers (https://github.com/ropensci/ReLTER).
## 
## If you use this package, please cite as:
## 
## Alessandro Oggioni, Micha Silver, Luigi Ranghetti & Paolo Tagliolato.
##     (2021) oggioniale/ReLTER: ReLTER v1.1.0 (1.1.0). Zenodo.
##     https://doi.org/10.5281/zenodo.5576813

or you can run ReLTER in a Docker container

Documentation of ReLTER

Visit the ReLTER website at docs.ropensci.org/ReLTER/ for further documentation, examples, and installation of the package.

Loading packages

After installing, we need to load the packages into this R session.

# Convenient way to load list of packages
pkg_list <- c("sf", "terra", "ReLTER", "tmap", "knitr", "glue")
lapply(pkg_list, require, character.only = TRUE)
## [[1]]
## [1] TRUE
## 
## [[2]]
## [1] TRUE
## 
## [[3]]
## [1] TRUE
## 
## [[4]]
## [1] TRUE
## 
## [[5]]
## [1] TRUE
## 
## [[6]]
## [1] TRUE

R Spatial

Start with the ReLTER examples

Basic functions

Information from site

ReLTER relies on the data entered into DEIMS-SDR.

Lake Maggiore

lakeMaggiore <- ReLTER::get_site_info(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  category = "Boundaries"
)
lakeMaggiore
## Simple feature collection with 1 feature and 8 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 8.47803 ymin: 45.72556 xmax: 8.860755 ymax: 46.18081
## Geodetic CRS:  WGS 84
## # A tibble: 1 × 9
##   title uri                  boundaries geoCoord country geoElev.avg geoElev.min
##   <chr> <chr>        <MULTIPOLYGON [°]> <chr>    <list>        <dbl>       <int>
## 1 Lago… http… (((8.615976 45.72628, 8.… POINT (… <chr>          194.         186
## # … with 2 more variables: geoElev.max <int>, geoElev.unit <chr>

leaflet::leaflet(lakeMaggiore) %>%
  leaflet::addProviderTiles(provider = "CartoDB.PositronNoLabels",
                            group = "Basemap",
                            layerId = 123) %>%
  leaflet::addTiles("http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png") %>% 
  leaflet::addPolygons(color = "#444444", weight = 1, smoothFactor = 0.5,
    opacity = 1.0, fillOpacity = 0.5)

Which kind of categories?

Following the specification of DEIMS-SDR for each site you can get:

  • Affiliations

  • Boundaries

  • Contacts

  • EnvCharacts

  • General

  • Infrastructure

  • Parameters

  • RelateRes

  • ResearchTop

not only map

siteInfo <- ReLTER::get_site_info(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  category = c("Affiliations")
)
knitr::kable(siteInfo$affiliation.projects[[1]])
label uri
LIFEPLAN https://cordis.europa.eu/project/id/856506
NETLAKE Cost Action ES1201 NA
eLTER (H2020) https://cordis.europa.eu/project/id/654359
eLTER PLUS (H2020) - RA https://cordis.europa.eu/project/id/871128
eLTER PLUS (H2020) - TA https://cordis.europa.eu/project/id/871128
eLTER PLUS (H2020) - VA https://cordis.europa.eu/project/id/871128
eLTER catalogue NA

Get info from Activity and …

Mar Piccolo di Taranto

Without map

activityNoMap <- ReLTER::get_activity_info(
  activityid =
  "https://deims.org/activity/8786fc6d-5d70-495c-b901-42f480182845",
  show_map = FALSE
)
activityNoMap
## Simple feature collection with 1 feature and 12 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 17.22656 ymin: 40.46438 xmax: 17.33162 ymax: 40.50408
## Geodetic CRS:  WGS 84
## # A tibble: 1 × 13
##   title                abstract keywords uri   type  created changed relatedSite
## * <chr>                <chr>    <list>   <chr> <chr> <chr>   <chr>   <list>     
## 1 Study of non-indige… "The in… <df>     http… acti… 2021-0… 2021-0… <df>       
## # … with 5 more variables: contacts.corresponding <list>,
## #   contacts.metadataProvider <list>, boundaries <POLYGON [°]>,
## #   observationParameters <lgl>, relatedResources <list>

with map

activityMap <- ReLTER::get_activity_info(
  activityid =
  "https://deims.org/activity/8786fc6d-5d70-495c-b901-42f480182845",
  show_map = TRUE
)

… and Dataset

The Map of dataset provided by Lake Maggiore

tDataset <- get_dataset_info(
  datasetid = "https://deims.org/dataset/38d604ef-decb-4d67-8ac3-cc843d10d3ef",
  show_map = TRUE
)

The table about dataset information

tDataset
## Simple feature collection with 1 feature and 33 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 11.88721 ymin: 43.20518 xmax: 15.86426 ymax: 45.91294
## Geodetic CRS:  WGS 84
## # A tibble: 1 × 34
##   title    abstract keywords uri   type  dateRange.from dateRange.to relatedSite
## * <chr>    <chr>    <list>   <chr> <chr> <chr>          <lgl>        <list>     
## 1 LTER No… The pre… <df>     http… data… 1965-01-01     NA           <df>       
## # … with 26 more variables: contacts.corresponding <list>,
## #   contacts.creator <list>, contacts.metadataProvider <lgl>,
## #   observationParameters <list>, observationSpecies <list>, dataPolicy <list>,
## #   doi <chr>, onlineLocation <list>, legal.accessUse <list>,
## #   legal.rights <lgl>, legal.legalAct <lgl>, legal.citation <lgl>,
## #   method.instrumentation <lgl>, method.qualityAssurance <lgl>,
## #   method.methodUrl <list>, method.methodDescription <list>, …

Missing information on DEIMS-SDR

However sometimes there are:

  • Multiple sites with similar names
  • Missing information
  • Sites with no boundary polygon

First example, the Kiskun region of Hungary

Query for Site Manager

# Multiple sites in the KISKUN region of Hungary
kiskun <- ReLTER::get_ilter_generalinfo(country_name = "Hungary",
                              site_name = "KISKUN")
# How many sites?
print(paste("In Kiskun region: ", length(kiskun$title), "sites"))
## [1] "In Kiskun region:  8 sites"

(kiskun$title)
## [1] "Kiskun Forest Reserve Sites, KISKUN LTER - Hungary"   
## [2] "VULCAN Kiskunsag, KISKUN LTER - Hungary"              
## [3] "Kiskun Restoration Experiments, KISKUN LTER - Hungary"
## [4] "Kiskun Site Network (Jedlik), KISKUN LTER - Hungary"  
## [5] "KISKUN LTER - Hungary"                                
## [6] "LTER Fulophaza Site, KISKUN LTER - Hungary"           
## [7] "Bugac-Bocsa-Orgovany Site, KISKUN LTER - Hungary"     
## [8] "Orgovany Site, KISKUN LTER - Hungary"
# Which site? Bugac-Bocsa
bugac_id <- kiskun[7,]$uri
bugac_details <- ReLTER::get_site_info(bugac_id,"Contacts")
(bugac_details$generalInfo.siteManager[[1]]['name'])
##          name
## 1 Gábor Ónodi

Now query for boundary

bugac_polygon <- ReLTER::get_site_info(bugac_id, "Boundaries")
## 
## ----
## This site does not have boundaries uploaded to DEIMS-SDR.
## Please verify in the site page: https://deims.org/609e5959-8cd8-44a0-ab42-eda521cd452a
## ----
str(bugac_polygon)
## tibble [1 × 9] (S3: tbl_df/tbl/data.frame)
##  $ title       : chr "Bugac-Bocsa-Orgovany Site, KISKUN LTER - Hungary"
##  $ uri         : chr "https://deims.org/609e5959-8cd8-44a0-ab42-eda521cd452a"
##  $ boundaries  : logi NA
##  $ geoCoord    : chr "POINT (19.5281 46.7183)"
##  $ country     :List of 1
##   ..$ : chr "Hungary"
##  $ geoElev.avg : int 112
##  $ geoElev.min : int 105
##  $ geoElev.max : int 120
##  $ geoElev.unit: chr "msl"
# No geometry
  • This site has the site manager’s name
  • but no boundary polygon

Second example, Gran Paradiso in Italy

paradiso <- ReLTER::get_ilter_generalinfo(country_name = "Italy",
                              site_name = "Gran Paradiso")
(paradiso$title)
## [1] "IT23 - Gran Paradiso National Park - Italy"
## [2] "Gran Paradiso National Park - Italy"
# Choose the second
paradiso_id <- paradiso[2,]$uri
paradiso_details <- ReLTER::get_site_info(paradiso_id, "Contacts")
# Multiple names for metadata:
paradiso_details$generalInfo.metadataProvider[[1]]['name']
##                 name
## 1 Alessandro Oggioni
## 2     Ramona Viterbi

# But what about funding agency
paradiso_details$generalInfo.fundingAgency
## [1] NA
  • This site has metadata providers
  • but no funding agency

Plotting functions

Additional plotting functions

Environmental parameters

ReLTER has implemented some revealing visualizations of the various parameters collected at LTER sites. One visualization is the pie chart of environmental parameters.

In an example above the DEIMS ID of Kis Balaton (Kiskun LTER) was found. We’ll use that site to show a pie chart of environmental variables collected in that site.

ReLTER::produce_site_parameters_pie("https://deims.org/8129fed1-37b3-48e6-b786-d416917acc72")

## # A tibble: 8 × 4
##   parameterGroups             n   freq perc 
##   <chr>                   <int>  <dbl> <chr>
## 1 agricultural parameters     1 0.0208 2%   
## 2 atmospheric parameters      1 0.0208 2%   
## 3 biological parameters      16 0.333  33%  
## 4 chemical parameters        16 0.333  33%  
## 5 ecosystem parameters        8 0.167  17%  
## 6 physical parameters         1 0.0208 2%   
## 7 soil parameters             1 0.0208 2%   
## 8 water parameters            4 0.0833 8%

Similarly, a “waffle” chart can be produced.

ReLTER::produce_site_parameters_waffle("https://deims.org/8129fed1-37b3-48e6-b786-d416917acc72")

## # A tibble: 8 × 4
##   parameterGroups             n   freq label
##   <chr>                   <int>  <dbl> <chr>
## 1 agricultural parameters     1 0.0208 2%   
## 2 atmospheric parameters      1 0.0208 2%   
## 3 biological parameters      16 0.333  33%  
## 4 chemical parameters        16 0.333  33%  
## 5 ecosystem parameters        8 0.167  17%  
## 6 physical parameters         1 0.0208 2%   
## 7 soil parameters             1 0.0208 2%   
## 8 water parameters            4 0.0833 8%

Map object of a site

The produce_site_map function produces a map of the site boundaries, within a given country and network.

tmap::tmap_mode("plot")
# Example of Lake Maggiore site
sitesNetwork <- ReLTER::get_network_sites(
  networkDEIMSID = "https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3"
)
# In the case of Italian sites are selected only true sites and excluded the
# macrosites.
sitesNetwork <- (sitesNetwork[!grepl('^IT', sitesNetwork$title),])
sf::st_crs(sitesNetwork) = 4326
siteMap <- ReLTER::produce_site_map(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  countryCode = "ITA",
  listOfSites = sitesNetwork,
  gridNx = 0.7,
  gridNy = 0.35
)

QR Code

The produce_site_qrcode function produces a QRCode of the site (or Activity, Dataset, Network, etc.)

Lake Maggiore

Interaction with third-party data

Some requirements for these fuctions

before continue please execute install development version of ReLTER Package

if (!require("ReLTER", quietly = TRUE))
  remotes::install_github("ropensci/ReLTER", ref = 'dev__withImprovements', force = TRUE)

Acquiring Earth Observation data

Functions within ReLTER help to acquire certain Earth Observation datasets.

The get_site_ODS() function offers to ReLTER users access to the OpenDataScience Europe (ODS) archive (https://maps.opendatascience.eu/) with landcover, NDVI, natura2000, Corine landcover, and OSM features, all at 30 meter pixel resolution. Cropping to site boundaries is done in the cloud, and due to the Cloud Optimized Geotiff (COG) format, downloads are quite small.

First example, Kis-Balaton site in Kiskun region, Hungary

# Get DEIMS ID for Kis-Balaton site 
kis_balaton <- ReLTER::get_ilter_generalinfo(country_name = "Hungary",
                              site_name = "Kis-Balaton")
kb_id = kis_balaton$uri
kb_polygon = ReLTER::get_site_info(kb_id, "Boundaries")

# Now acquire landcover and NDVI from ODS
kb_landcover = ReLTER::get_site_ODS(kb_id, dataset = "landcover")
kb_ndvi_summer = ReLTER::get_site_ODS(kb_id, "ndvi_summer")

# Plot maps
tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(kb_polygon) +
  tm_borders(col = "purple") + 
  tm_shape(kb_ndvi_summer) +
  tm_raster(alpha=0.7, palette = "RdYlGn")
## Variable(s) "NA" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(kb_polygon) +
  tm_borders(col = "purple") + 
  tm_shape(kb_landcover) +
  tm_raster(alpha=0.7, palette = "Set1")

Second example, Companhia das Lezírias, Portugal

lezirias <- ReLTER::get_ilter_generalinfo(country_name = "Portugal",
                              site_name = "Companhia")
lezirias_id = lezirias$uri
lezirias_polygon = ReLTER::get_site_info(lezirias_id, "Boundaries")

# Now acquire spring NDVI from OSD
lezirias_ndvi_spring = ReLTER::get_site_ODS(lezirias_id, "ndvi_spring")

# Plot maps
tmap::tm_basemap("OpenStreetMap.Mapnik") + 
  tmap::tm_shape(lezirias_polygon) +
  tmap::tm_borders(col = "purple") + 
  tmap::tm_shape(lezirias_ndvi_spring) +
  tmap::tm_raster(alpha=0.7, palette = "RdYlGn")
## Variable(s) "NA" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

The function outputs a raster. We can save to Geotiff for use in other GIS

class(lezirias_ndvi_spring)
## [1] "SpatRaster"
## attr(,"package")
## [1] "terra"
terra::writeRaster(x = lezirias_ndvi_spring,
            filename = "lezirias_ndvi_spring.tif",
            overwrite = TRUE)

The “lezirias_ndvi_spring.tif” file has been created.

Research topics, Related resources

List all research topics throughout an LTER network.

List related resources for an LTER network.

We demonstrate with the LTER network in Slovakia. Then filter for “Ecosystem” research.

lter_slovakia_id <- "https://deims.org/networks/3d6a8d72-9f86-4082-ad56-a361b4cdc8a0"
slv_research_topics <- ReLTER::get_network_research_topics(lter_slovakia_id)
ecosystem_items <- grepl(pattern = "ecosystem",
                         slv_research_topics$researchTopicsLabel,
                         fixed = TRUE)
# Here is the filtered list
knitr::kable(slv_research_topics[ecosystem_items,])
researchTopicsLabel researchTopicsUri
ecosystem ecology http://vocabs.lter-europe.net/EnvThes/21689
ecosystem function http://vocabs.lter-europe.net/EnvThes/20519
ecosystem service http://vocabs.lter-europe.net/EnvThes/20520

List related resources

knitr::kable(get_network_related_resources(lter_slovakia_id))
relatedResourcesTitle uri relatedResourcesChanged
Báb_temperature_precipitation_LTER_EU_SK_001_2014-2018 https://deims.org/dataset/8f80225a-1250-470b-9092-31d61bde3d44 2019-12-20 13:21:00
LTER_Jalovecka dolina temperature 2003-2017 https://deims.org/dataset/122e06fb-11f3-43a7-abc5-067bb302c92b 2020-01-07 15:00:00
LTER Jalovecka dolina precipitation 2013-2017 https://deims.org/dataset/84e13ed2-e353-4e1a-abb3-2cf5d596007e 2019-12-20 13:21:00
Climate Kralova hola_LTER_EU_SK_009_2015-2018 https://deims.org/dataset/85d310ab-011a-414c-b90b-3358058dc0cd 2019-12-20 13:21:00
LTER EES Kremicke vrchy climate https://deims.org/dataset/ae9ca83c-77b8-493e-9c63-49dcc6a46c5f 2019-12-20 13:21:00
LTER Polana-Hukavsky_grun temperature precipitation 2011-2017 https://deims.org/dataset/b7507d3d-0379-4930-a2cb-f8a10b77439b 2019-12-20 13:21:00
NA NA NA

Acquiring biodiversity data

Functions within ReLTER help to acquire certain third parties biodiversity datasets. The get_site_speciesOccurrences function1, offers to ReLTER users access to the occurrence records from GBIF (via rgbif R package), iNaturalist and OBIS carried out within the boundaries of the site.

Coauthor of these functions are Martina Zilioli and Paolo Tagliolato.

1 get_site_speciesOccurrences, map_occ_gbif2elter and save_occ_eLTER_reporting_Archive currently are delivered only with dev__withImprovements branch of ReLTER

First example, the Gulf Of Venice (GOV)

# DEIMS.iD of eLTER site Gulf Of Venice (GOV)
GOVid <- "https://deims.org/758087d7-231f-4f07-bd7e-6922e0c283fd"
resGOV <- ReLTER::get_site_speciesOccurrences(
  deimsid = GOVid, list_DS = "obis", show_map = TRUE, limit = 10)

Second example, the Saldur River Catchment

# DEIMS.iD of eLTER the Saldur River Catchment site 
saldur_id <- "https://deims.org/97ff6180-e5d1-45f2-a559-8a7872eb26b1"
occ_SRC <- ReLTER::get_site_speciesOccurrences(
  deimsid = saldur_id, list_DS = c("gbif", "inat"), show_map = TRUE, limit = 100)

Trasform this data into eLTER data template

Fields mapping among the three data source schemas (i.e., GBIF, iNaturalist, OBIS) and the eLTER data-reporting template (Peterseil et al., 2021) was carried out so as to design ReLTER functions: map_occ_gbif2elter and save_occ_eLTER_reporting_Archive.

Below an example of iNaturalist export data, for the Saldur River Catchment site.

library(dplyr)
saldurid <- "https://deims.org/97ff6180-e5d1-45f2-a559-8a7872eb26b1"
resSaldur <- ReLTER::get_site_speciesOccurrences(
  deimsid = saldurid, list_DS = c("gbif", "inat"), show_map = FALSE, limit = 20,
  exclude_inat_from_gbif = TRUE)
# iNaturalist
tblSaldur_inat <- tibble::as_tibble(resSaldur$inat)
outInat <- tblSaldur_inat %>%
  ReLTER::map_occ_inat2elter(deimsid = saldurid)
ReLTER::save_occ_eLTER_reporting_Archive(outInat)

The eLTER useful archive created is:

  • biodiv_occurrence_site_97ff6180-e5d1-45f2-a559-8a7872eb26b1_inat.zip

Show a chaining of several functions

Please return to the main version of package

Before continue please execute install the last version of ReLTER Package

if (!require("ReLTER", quietly = TRUE))
  remotes::install_github("ropensci/ReLTER", force = TRUE)
if (!require("dplyr", quietly = TRUE))
  install.packages("dplyr")
library(ReLTER)
library(dplyr)

LTER Network

This example uses the LTER network in Greece. Call the produce_network_points_map() function (requires both DEIMS network ID and the three letter ISO code for the country to be mapped) to get all sites in a country.

tmap::tmap_mode("view")
## tmap mode set to interactive viewing
lter_greece_id = "https://deims.org/networks/83453a6c-792d-4549-9dbb-c17ced2e0cc3"
lter_greece <- ReLTER::produce_network_points_map(networkDEIMSID = lter_greece_id, countryCode = "GRC")

grc <- readRDS("gadm36_GRC_0_sp.rds")  # available from `produce_network_points_map()

tmap::tm_shape(grc) +
  tmap::tm_borders(col = "purple", lwd = 2) +
  tmap::tm_grid(alpha = 0.4) +
  lter_greece

Get general information of the network’s sites

listItaSites <- ReLTER::get_network_sites(
 networkDEIMSID =
   "https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3"
) %>%
  dplyr::filter(!grepl('^IT', title))
## 
## ----
## The number of the sites on the map can be more than
## presents in the network, because some theme are represented in DEIMS-SDR
## with multiple points (e.g.
## https://deims.org/18998d9a-7ff5-4e9d-a971-9694e0a4914d).
## ----

knitr::kable(
  listItaSites[1:10, ],
  caption = "The list of site for LTER-Italy network"
)
The list of site for LTER-Italy network
title changed uri coordinates
Acquatina - Italy 2021-12-14T14:49:45+0100 https://deims.org/8e1909ae-afc0-4207-9314-68e234d57405 POINT (18.24 40.44)
Torgnon grassland Tellinod (IT19 Aosta Valley) - Italy 2021-12-15T13:15:49+0100 https://deims.org/a03ef869-aa6f-49cf-8e86-f791ee482ca9 POINT (7.58 45.84)
Renon BOL1 - Italy 2021-12-15T12:28:35+0100 https://deims.org/5d32cbf8-ab7c-4acb-b29f-600fec830a1d POINT (11.4336 46.5868)
Collelongo-Selva Piana ABR1 - Italy 2021-12-14T15:23:19+0100 https://deims.org/9b1d144a-dc37-4b0e-8cda-1dda1d7667da POINT (13.5881 41.8494)
Colognole TOS1 - Italy 2021-12-14T15:26:50+0100 https://deims.org/fdd9b462-d2a9-441a-80a1-f4e8947f5577 POINT (10.4386 43.5094)
Tarvisio FRI2 - Italy 2021-12-15T13:12:14+0100 https://deims.org/5907d0b6-7b4d-4260-a669-4bc0f61d1696 POINT (13.5933 46.4894)
Val Masino LOM1 - Italy 2021-12-15T13:18:47+0100 https://deims.org/68a5673c-9172-48cc-88e5-b9408b203309 POINT (9.59829 46.24215)
Alimini - Italy 2021-12-14T15:13:09+0100 https://deims.org/765cad42-25da-4893-b4cc-eb1f393b4b47 POINT (18.441 40.202)
Appennino centrale: Gran Sasso d’Italia - Italy 2021-12-14T15:14:43+0100 https://deims.org/c0738b00-854c-418f-8d4f-69b03486e9fd POINT (13.55 42.44)
Appennino centrale: Velino-Duchessa - Italy 2021-12-14T15:14:59+0100 https://deims.org/12c79ecb-7890-4b75-9655-0883dacd8a29 POINT (13.35 42.17)

Contact list of all lake site managers

sites <- as_tibble(
  listItaSites
) %>%
  filter(grepl("Lago", title)) %>%
  filter(!row_number() %in% c(1, 21, 22))

allSiteContact <- lapply(as.list(sites$uri),
    ReLTER::get_site_info, category = "Contacts"
  )
contacts <- tibble::tibble(
  siteName = NA,
  managerName = NA,
  managerEmail = NA,
  managerORCID = NA
)
for (i in seq_len(length(allSiteContact))) {
  contacts <- contacts %>% 
    tibble::add_row(
      siteName = allSiteContact[[i]]$title,
      managerName = allSiteContact[[i]]$generalInfo.siteManager[[1]]$name,
      managerEmail = allSiteContact[[i]]$generalInfo.siteManager[[1]]$email,
      managerORCID = allSiteContact[[i]]$generalInfo.siteManager[[1]]$orcid
    )
}

# Contacts table
knitr::kable(
  contacts,
  caption = "List of the contacts"
)
List of the contacts
siteName managerName managerEmail managerORCID
NA NA NA NA
Lago Bidighinzu - Italy Bachisio Mario Padedda bmpadedda@uniss.it https://orcid.org/0000-0002-0988-5613
Lago Braies - Italy Renate Alber renate.alber@provinz.bz.it NA
Lago Cedrino - Italy Bachisio Mario Padedda bmpadedda@uniss.it https://orcid.org/0000-0002-0988-5613
Lago Cuga - Italy Bachisio Mario Padedda bmpadedda@uniss.it https://orcid.org/0000-0002-0988-5613
Lago di Candia - Italy Marzia Ciampittiello marzia.ciampittiello@irsa.cnr.it NA
Lago di Como - Italy Fabio Buzzi f.buzzi@arpalombardia.it NA
Lago di Garda - Italy Nico Salmaso nico.salmaso@fmach.it NA
Lago di Orta - Italy Roberta Piscia roberta.piscia@irsa.cnr.it NA
LTSER Lago di Tovel - Italy Ulrike Obertegger ulrike.obertegger@fmach.it NA
Lago Maggiore - Italy Michela Rogora michela.rogora@irsa.cnr.it NA
Lago Monte Lerno - Italy Bachisio Mario Padedda bmpadedda@uniss.it https://orcid.org/0000-0002-0988-5613
Lago Paione Inferiore - Italy Michela Rogora michela.rogora@irsa.cnr.it NA
Lago Paione Superiore - Italy Michela Rogora michela.rogora@irsa.cnr.it NA
Lago Piccolo di Monticolo - Italy Renate Alber renate.alber@provinz.bz.it NA
Lago Piramide Inferiore - Nepal Andrea Lami andrea.lami@irsa.cnr.it NA
Lago Piramide Superiore - Nepal Andrea Lami andrea.lami@irsa.cnr.it NA
Lago Piramide Superiore - Nepal Michela Rogora michela.rogora@irsa.cnr.it NA
Lago Santo Parmense - Italy Giampaolo Rossetti giampaolo.rossetti@unipr.it NA
Lago Scuro Parmense - Italy Giampaolo Rossetti giampaolo.rossetti@unipr.it NA
Lago Sos Canales - Italy Bachisio Mario Padedda bmpadedda@uniss.it https://orcid.org/0000-0002-0988-5613

Get all resources delivered by EU eLTER sites

Some other required package

if (!require("purrr", quietly = TRUE))
  install.packages("purrr")

library(purrr)

Resources delivered

eLTER_eu_networks <- readr::read_csv("./other/eLTER_eu_networks.csv", show_col_types = FALSE) %>%
  tibble::as_tibble()

related_resources <- purrr::map_dfr(
  as.list(
    eLTER_eu_networks$DEIMS.iD
  ),
  function (x) {
    ReLTER::get_network_related_resources(x) %>%
      dplyr::filter(!is.na(uri)) %>%
      dplyr::mutate(
        networkID = x,
        type = stringr::str_replace(uri, "https://deims.org/(.*)/.*","\\1")
      )
  }
) %>%
  dplyr::inner_join(eLTER_eu_networks, by = c("networkID" = "DEIMS.iD")) %>%
  dplyr::select(
    title = relatedResourcesTitle,
    uri,
    lastChanged = relatedResourcesChanged,
    networkID,
    type,
    network = eLTER_EU_Networks,
    country
  )

tbl_resources <- related_resources %>%
  dplyr::count(country, type) %>%
  tidyr::pivot_wider(names_from = type, values_from = n, values_fill = 0)

knitr::kable(
  tbl_resources,
  caption = "eLTER EU networks related resources"
)
eLTER EU networks related resources
country activity dataset sensors
Austria 30 172 36
Belgium 1 7 0
Bulgaria 0 17 0
Denmark 0 2 0
Finland 0 18 4
France 0 2 0
Germany 1 95 0
Greece 0 3 0
Hungary 0 19 0
Israel 0 18 0
Italy 11 223 19
Latvia 0 14 0
Lithuania 0 2 0
Netherlands 0 2 0
Norway 0 2 0
Poland 0 11 0
Portugal 0 44 0
Romania 7 8 0
Serbia 0 4 0
Slovakia 0 6 0
Slovenia 0 3 0
Spain 15 56 0
Sweden 0 21 0
Switzerland 0 18 0
United Kingdom 0 243 0

Map of dataset delivered

Some other required packages

library(rnaturalearth)
library(rworldmap)
## Loading required package: sp
## ### Welcome to rworldmap ###
## For a short introduction type :   vignette('rworldmap')
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:terra':
## 
##     arrow

Dataset distribution map

# Get the world map
worldMap <- rworldmap::getMap()

world_map <- rnaturalearth::ne_countries(scale = 50, returnclass = 'sf')
europe_map <- world_map %>%
  filter(name %in% related_resources$country)

elter_map <- europe_map %>%
  dplyr::select(
    name,
    geometry
  ) %>%
  dplyr::left_join(tbl_resources, by = c("name" = "country"))

map_datasets <- ggplot2::ggplot() +
  ggplot2::geom_sf(data = elter_map, ggplot2::aes(fill = dataset)) +
  ggplot2::coord_sf(xlim = c(-20, 45), ylim = c(28, 73), expand = FALSE)

map_datasets

Run ReLTER i a docker container

Rocker ReLTER

A Docker image for ReLTER package.

Capabilities

Run RStudio with preinstalled ReLTER package through Docker.

Quick setup

  1. Follow the instructions to install Docker on your computer.
  2. Open a terminal (“command prompt” in Windows) and write the following command to download the rocker_relter image
docker pull ptagliolato/rocker_relter
  1. Run the image:
docker run -e PASSWORD=yourpassword -p 8080:8787 \
  ptagliolato/rocker_relter
* This will run RStudio on port 8080, you can change the port as you like.
* You can change "yourpassword" with the password you prefer.
* If you close the terminal, the image will stop. To avoid this, add "-d" before "-e"
to run "detached" from the terminal.
* See further options in the last section.

Open your browser at localhost:8080 and login with

  user: rstudio
  password: yourpassword

Run experimental features of ReLTER package

ReLTER package is evolving. You can run some of the features recently added to the package (namely those presented in eLTER Plus deliverable D.4.1 to retrieve and manage biodiversity data from GBIF, OBIS and iNaturalist) by using the alternative image “dev__withImprovements”:

docker pull ptagliolato/rocker_relter:dev__withImprovements

docker run -e PASSWORD=yourpassword -p 8080:8787 \
  ptagliolato/rocker_relter:dev__withImprovements

Preserve your work (use a docker volume)

When you stop a docker container, the files created within it are lost. In order to preserve your work across different runs, link a local volume (in this example, the current working directory, $(pwd)) to the container:

docker run -d -v $(pwd):/home/rstudio -e PASSWORD=yourpassword \
  -p 8080:8787 ptagliolato/rocker_relter

Final remarks

How to collaborate with ReLTER